﻿<%@ Page Language="C#" MasterPageFile="~/Layout.Master" AutoEventWireup="true" CodeBehind="addRoom.aspx.cs" Inherits="PT.WebForm7" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    </asp:Content>
<asp:Content ID="cpContent" ContentPlaceHolderID="cpContent" runat="server">
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConflictDetection="CompareAllValues" 
        ConnectionString="<%$ ConnectionStrings:HotelConnectionString2 %>" 
        DeleteCommand="DELETE FROM [Rooms] WHERE [id] = @original_id AND [size] = @original_size AND [cost] = @original_cost AND [name] = @original_name" 
        InsertCommand="INSERT INTO [Rooms] ([size], [cost], [name]) VALUES (@size, @cost, @name)" 
        OldValuesParameterFormatString="original_{0}" 
        SelectCommand="SELECT * FROM [Rooms]" 
        UpdateCommand="UPDATE [Rooms] SET [size] = @size, [cost] = @cost, [name] = @name WHERE [id] = @original_id AND [size] = @original_size AND [cost] = @original_cost AND [name] = @original_name">
        <DeleteParameters>
            <asp:Parameter Name="original_id" Type="Int32" />
            <asp:Parameter Name="original_size" Type="Int32" />
            <asp:Parameter Name="original_cost" Type="Int32" />
            <asp:Parameter Name="original_name" Type="String" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="size" Type="Int32" />
            <asp:Parameter Name="cost" Type="Int32" />
            <asp:Parameter Name="name" Type="String" />
            <asp:Parameter Name="original_id" Type="Int32" />
            <asp:Parameter Name="original_size" Type="Int32" />
            <asp:Parameter Name="original_cost" Type="Int32" />
            <asp:Parameter Name="original_name" Type="String" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="size" Type="Int32" />
            <asp:Parameter Name="cost" Type="Int32" />
            <asp:Parameter Name="name" Type="String" />
        </InsertParameters>
    </asp:SqlDataSource>
    <asp:Table ID="Table1" runat="server" Width="100%" CellSpacing="10" 
        HorizontalAlign="Left" Height="160px" BorderStyle="None">
        <asp:TableRow runat="server" Height="28px" Width="142px">
        </asp:TableRow>
        <asp:TableRow runat="server">
            <asp:TableCell runat="server" HorizontalAlign="Right" Width="33%">Opis</asp:TableCell>
            <asp:TableCell runat="server" Width="33%">
            <asp:TextBox ID="nameTextBox" runat="server" Height="28" BorderStyle="Solid" BorderWidth="1" BorderColor="#FF9900"></asp:TextBox>
            </asp:TableCell>
            <asp:TableCell runat="server" Width="33%">
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Podaj opis." ControlToValidate="nameTextBox" ValidationGroup="room"></asp:RequiredFieldValidator>
            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow runat="server">
            <asp:TableCell runat="server" HorizontalAlign="Right" Width="33%">Cena za dobę</asp:TableCell>
            <asp:TableCell runat="server" Width="33%">
            <asp:TextBox ID="costTextBox" runat="server" BorderStyle="Solid" BorderWidth="1" BorderColor="#FF9900" Height="28"></asp:TextBox>
            </asp:TableCell>
            <asp:TableCell runat="server" Width="33%">
            <asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage="Proszę wybrać cenę z  przedzialu <1, 1000>." ControlToValidate="costTextBox" Type="Integer" MaximumValue="1000" MinimumValue="1" SetFocusOnError="True" CultureInvariantValues="False" ValidationGroup="room"></asp:RangeValidator>
            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow runat="server">
            <asp:TableCell runat="server" HorizontalAlign="Right" Width="33%">Rozmiar</asp:TableCell>
            <asp:TableCell runat="server" Width="33%">
            <asp:TextBox ID="sizeTextBox" runat="server" BorderStyle="Solid" BorderColor="#FF9900" BorderWidth="1" Height="28"></asp:TextBox>
            </asp:TableCell>
            <asp:TableCell runat="server" Width="33%">
            <asp:RangeValidator ID="RangeValidator2" runat="server" ErrorMessage="Proszę wybrać rozmiar z przedziału <1, 10>." ControlToValidate="sizeTextBox" Type="Integer" MaximumValue="10" MinimumValue="1" ValidationGroup="room" CultureInvariantValues="True"></asp:RangeValidator>
            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow runat="server">
            <asp:TableCell runat="server" HorizontalAlign="Right" Width="33%"></asp:TableCell>
            <asp:TableCell runat="server" Width="33%">
            <asp:Button ID="addButton" runat="server" Text="Dodaj pokój" onclick="addButton_Click" CssClass="addButton" BorderStyle="Solid" BorderColor="#FF9900" BorderWidth="1" ValidationGroup="room" />
            </asp:TableCell>
            <asp:TableCell ID="TableCell3" runat="server" Width="33%"></asp:TableCell>
        </asp:TableRow>
    </asp:Table>
    <br />
    
    
</asp:Content>
